<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Notices extends CI_Controller {
	
	function index(){
		
		//获取公告
		$this->load->model('site_model');
		$gonggaosite = $this->site_model->get_site_one(array('url'=>'gonggao'));			
		$cdata['where']['nid'] = $gonggaosite['id'];
		$cdata['page_size']  = 8;
		$cdata['page_start'] = 0;
		$cdata['select'] 	= 1;
		$this->load->model('article_model');
		
		$ret = $this->article_model->get_article_list($cdata);
		$list = $ret['article_list'];
		$data['list'] = $list;
		$this->load->view('mobile/notices',$data);
	}
	
	function more($page = 0){
		$page = intval($page);
		$this->load->model('site_model');
		$gonggaosite = $this->site_model->get_site_one(array('url'=>'gonggao'));
		$cdata['where']['nid'] = $gonggaosite['id'];
		$cdata['page_size']  = 8;
		$cdata['page_start'] = ($page-1)*$cdata['page_size'];
		$cdata['select'] 	= 1;
		$this->load->model('article_model');
		$ret = $this->article_model->get_article_list($cdata);
		//$data['list'] = $list;
		$list = $ret['article_list'];
		foreach ($list as $key => $val){
			$list[$key]['ptime'] = date('Y-m-d', $val['ptime']);
		}
		echo json_encode($list);
	}
	
	function content($id){
		$this->load->model('article_model');
		$article = $this->article_model->get_article_obj($id);
		$vdata['article'] = $article;
		$this->load->view("mobile/notices_content", $vdata);
	}
}